//
//  LiveDetailUiParameter.m
//  DuTe
//
//  Created by Gikki Ares on 2020/12/18.
//  Copyright © 2020 vgemv. All rights reserved.
//

#import "JsBarrageButtonVm.h"
#import "JsColorManager.h"
#import "JsGeometryManager.h"

@interface JsBarrageButtonVm()
{
	
	NSArray <JsBarrageButtonVmStyle *> * marr_style;
}


@end

@implementation JsBarrageButtonVm


- (instancetype)init {
	if(self = [super init]) {
	self.mcolor_titleLabel = [UIColor blackColor];
	self.mfont_titleLabel = [UIFont systemFontOfSize:12];
	self.mTextAlignment = NSTextAlignmentCenter;
	
	CGFloat selfWidth = [self wrapperContentSize].width;
	CGFloat selfHeight = [self wrapperContentSize].height;
	CGFloat sendButtonWidth = 100;
	CGFloat selfExpandWidth = sendButtonWidth + selfWidth;
	CGFloat imageSize = 25;

	
	JsBarrageButtonVmStyle * style0 = [JsBarrageButtonVmStyle new];
	style0.size = CGSizeMake(selfWidth, selfHeight);
		style0.imageName =@"BarrageOff.png";
	style0.toggleButtonFrame = CGRectMake(0, 0, selfWidth, selfHeight);
		style0.sendButtonFrame = [JsGeometryManager frameHAlignLeftVAlignCenterWithContainerSize:style0.sendButtonFrame.size size:CGSizeZero offset:CGPointMake(-style0.toggleButtonFrame.size.width/2, 0)];
	style0.mcolor_toggleButton = [UIColor clearColor];
		style0.imageViewFrame = [JsGeometryManager frameAlignCenterWithContainerSize:style0.toggleButtonFrame.size size:CGSizeMake(imageSize, imageSize)];
//	style0.imageViewFrame = [JsGeometryManager frameHCenterVCenterWithSize:CGSizeMake(imageSize, imageSize) containerSize:style0.toggleButtonFrame.size offset:CGPointZero];
	
	JsBarrageButtonVmStyle * style1 = [JsBarrageButtonVmStyle new];
	style1.imageName= @"BarrageOn.png";
	style1.mstr_title = @"点我发弹幕";
	style1.size = CGSizeMake(selfExpandWidth, selfHeight);
	style1.toggleButtonFrame = CGRectMake(sendButtonWidth, 0, selfWidth, selfHeight);
	style1.sendButtonFrame = CGRectMake(0, 0, sendButtonWidth, selfHeight);
		style1.imageViewFrame = [JsGeometryManager frameCenterlyWithSize:CGSizeMake(imageSize, imageSize) siblingFrame:style1.toggleButtonFrame];
//		style1.labelFrame = [JsGeometryManager frameHCenterVCenterWithContainerSize:CGSizeMake(sendButtonWidth-30, 40) containerSize:style1.sendButtonFrame.size];
		style1.labelFrame = [JsGeometryManager frameAlignCenterWithContainerSize:style1.sendButtonFrame.size size:CGSizeMake(sendButtonWidth-30, 40)];
	style1.mcolor_toggleButton = [UIColor whiteColor];
	
	JsBarrageButtonVmStyle * style2 = [JsBarrageButtonVmStyle new];
	style2.imageName = @"BarrageOn.png";
	style2.mstr_title = @"弹幕输入中";
	style2.size = CGSizeMake(selfExpandWidth, selfHeight);
	style2.toggleButtonFrame = CGRectMake(sendButtonWidth, 0, selfWidth, selfHeight);
	style2.sendButtonFrame = CGRectMake(0, 0, sendButtonWidth, selfHeight);
		style2.imageViewFrame = [JsGeometryManager frameCenterlyWithSize:CGSizeMake(imageSize, imageSize) siblingFrame:style2.toggleButtonFrame];
//	style2.labelFrame = [JsGeometryManager frameHCenterVCenterWithSize:CGSizeMake(sendButtonWidth-30, 40) containerSize:style2.sendButtonFrame.size];
		style2.labelFrame = [JsGeometryManager frameAlignCenterWithContainerSize:style2.sendButtonFrame.size size:CGSizeMake(sendButtonWidth-30, 40)];
	style2.mcolor_toggleButton = [UIColor whiteColor];
	
	marr_style = @[style0,style1,style2];
	}
	return self;
}

- (JsBarrageButtonVmStyle *)currentVmStyle {
	return marr_style[self.state];
}


- (CGSize)wrapperContentSize {
	CGFloat selfWidth = 40;
	CGFloat selfHeight = 30;
	return CGSizeMake(selfWidth, selfHeight);
}

@end


@implementation JsBarrageButtonVmStyle


@end
